import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: WHY
 * Date: 2023-02-20
 * Time: 23:02
 */

public class Test {
    public static int max(int a,int b) {
        return Math.max(a,b);
    }

    public static double max(double a,double b,double c) {

        double m = Math.max(a,b);
        return Math.max(m,c);
    }
    public static int sum(int a,int b) {
        return a+b;
    }

    public static double sum(double a,double b,double c) {
        return a+b+c;
    }
    //求斐波那契数列的第n项
    public static int fib(int n) {
        if(n == 1 || n == 2 ) {
            return 1;
        }
        int f1 = 1;

        int f2 = 1;

        int f3 = 1;

        for (int i = 3; i <= n; i++) {

            f3 = f1+f2;

            f1 = f2;

            f2 = f3;

        }

        return f3;

    }


    public static void main5(String[] args) {
        System.out.println(max3(6, 8, 5));
    }
        public static int max2(int a,int b) {
            return a > b ? a:b;
        }

        public static int max3(int a,int b,int c) {
            int max = max2(a,b);
            return max > c ? max : c;
        }


    //乘法口诀表
    public static void main4(String[] args) {
        for (int i = 1; i <= 9 ; i++) {
            for (int j = 1; j <= i; j++) {
                System.out.print(j+"*"+i+"="+i*j+" ");
            }
            System.out.println();
        }
    }

    public static void main3(String[] args) {
//猜密码
        Scanner scan = new Scanner(System.in);
        int count = 3;//只有三次机会
        while (count != 0) {//机会没用完时，就进入程序。
            System.out.println("请输入密码：");
            String password = scan.next();
            if (password.equals("123")) {
                System.out.println("密码正确");
                break;//密码输入正确时就跳出循环
            } else {
                count--;//错误一次就减少一次机会。
                System.out.println("请重新输入，你还有" + count + "机会");
            }
        }
    }

    //倒序输出每个数字上的数
    public static void main2(String[] args) {
        Scanner scanner=new Scanner(System.in);
        int a=scanner.nextInt();
        printOut(a);
    }

    public static void printOut(int n) {
        System.out.print(n % 10);

        if (n >= 10) {
            printOut(n / 10);
        }
    }
    //算1/1-1/2+1/3-1/4+1/5 …… + 1/99 - 1/100 的值 。
    public static void main1(String[] args) {
        int i=0;
        int flag=1;
        float sum=0.0f;
        for(i = 1; i <= 100; i++)
        {
            sum+=(1.0/i)*flag;
            flag*=-1;
        }
        System.out.println(sum);
    }
}
